Skip to content

Conversation

thesynthax
Copy link

No description provided.

Copy link
Member

@lsalvadore lsalvadore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved with a few syntax fixes. I can do them for you at merge time if you prefer.
Thanks for your submission!

@@ -0,0 +1,23 @@
[[gsoc25-macdo-mdo]]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We usually do not put labels at the beginning of reports. Please remove it unless you have some special need.

Suggested change
[[gsoc25-macdo-mdo]]

=== mac_do(4) and mdo(1) Improvements

Links: +
https://wiki.freebsd.org/SummerOfCode2025Projects/MacDoAndMDoImprovements
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a different format for the links section. We need to explicitly use the link: prefix and to repeat it twice for technical reasons.

Suggested change
https://wiki.freebsd.org/SummerOfCode2025Projects/MacDoAndMDoImprovements
link:https://wiki.freebsd.org/SummerOfCode2025Projects/MacDoAndMDoImprovements[Wiki page] URL: link:https://wiki.freebsd.org/SummerOfCode2025Projects/MacDoAndMDoImprovements[]


Contact: Kushagra Srivastava <[email protected]>

As part of Google Summer of Code 2025, I worked on two related sub-projects in the FreeBSD Project: kernel improvements to `mac_do(4)` and userland enhancements to `mdo(1)`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a specific macro for man pages.

Suggested change
As part of Google Summer of Code 2025, I worked on two related sub-projects in the FreeBSD Project: kernel improvements to `mac_do(4)` and userland enhancements to `mdo(1)`.
As part of Google Summer of Code 2025, I worked on two related sub-projects in the FreeBSD Project: kernel improvements to man:mac_do[4] and userland enhancements to man:mdo[1].


As part of Google Summer of Code 2025, I worked on two related sub-projects in the FreeBSD Project: kernel improvements to `mac_do(4)` and userland enhancements to `mdo(1)`.

`mac_do(4)` is a kernel MAC security module that allows controlled credential transitions without requiring setuid binaries. The project extended it in two key ways:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do not need to refer to the man page each single time.
We need to put one sentence per line.

Suggested change
`mac_do(4)` is a kernel MAC security module that allows controlled credential transitions without requiring setuid binaries. The project extended it in two key ways:
mac_do is a kernel MAC security module that allows controlled credential transitions without requiring setuid binaries.
The project extended it in two key ways:


`mac_do(4)` is a kernel MAC security module that allows controlled credential transitions without requiring setuid binaries. The project extended it in two key ways:

* **Per-jail configuration of authorized executables** – administrators can now specify a list of executables per-jail, permitted to request credential transitions, instead of being limited to the hardcoded `/usr/bin/mdo`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a special syntax for filenames too.

Suggested change
* **Per-jail configuration of authorized executables** – administrators can now specify a list of executables per-jail, permitted to request credential transitions, instead of being limited to the hardcoded `/usr/bin/mdo`.
* **Per-jail configuration of authorized executables** – administrators can now specify a list of executables per-jail, permitted to request credential transitions, instead of being limited to the hardcoded [.filename]#/usr/bin/mdo#.

`mac_do(4)` is a kernel MAC security module that allows controlled credential transitions without requiring setuid binaries. The project extended it in two key ways:

* **Per-jail configuration of authorized executables** – administrators can now specify a list of executables per-jail, permitted to request credential transitions, instead of being limited to the hardcoded `/usr/bin/mdo`.
* **Support for traditional credential-changing syscalls** – transitions requested via `setuid(2)`, `setgid(2)`, `setgroups(2)`, and related functions are now intercepted and authorized through `mac_do(4)`, in addition to the original `setcred(2)` mechanism.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* **Support for traditional credential-changing syscalls** – transitions requested via `setuid(2)`, `setgid(2)`, `setgroups(2)`, and related functions are now intercepted and authorized through `mac_do(4)`, in addition to the original `setcred(2)` mechanism.
* **Support for traditional credential-changing syscalls** – transitions requested via man:setuid[2], man:setgid[2], man:setgroups[2], and related functions are now intercepted and authorized through mac_do, in addition to the original man:setcred[2] mechanism.

* **Per-jail configuration of authorized executables** – administrators can now specify a list of executables per-jail, permitted to request credential transitions, instead of being limited to the hardcoded `/usr/bin/mdo`.
* **Support for traditional credential-changing syscalls** – transitions requested via `setuid(2)`, `setgid(2)`, `setgroups(2)`, and related functions are now intercepted and authorized through `mac_do(4)`, in addition to the original `setcred(2)` mechanism.

On the userland side, the companion tool `mdo(1)` was extended to:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
On the userland side, the companion tool `mdo(1)` was extended to:
On the userland side, the companion tool mdo was extended to:

Comment on lines +19 to +21
* Provide a `--print-rule` option to display the corresponding `mac_do(4)` rule for a requested transition.

Together, these improvements make `mac_do(4)` and `mdo(1)` far more flexible and practical, enabling safer privilege transitions without relying on setuid executables and with strong jail integration.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Provide a `--print-rule` option to display the corresponding `mac_do(4)` rule for a requested transition.
Together, these improvements make `mac_do(4)` and `mdo(1)` far more flexible and practical, enabling safer privilege transitions without relying on setuid executables and with strong jail integration.
* Provide a `--print-rule` option to display the corresponding mac_do rule for a requested transition.
Together, these improvements make mac_do and mdo far more flexible and practical, enabling safer privilege transitions without relying on setuid executables and with strong jail integration.

@thesynthax
Copy link
Author

Sure! Thanks a lot!

freebsd-git pushed a commit that referenced this pull request Oct 10, 2025
@lsalvadore
Copy link
Member

Merged, thanks!

@lsalvadore lsalvadore closed this Oct 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants